# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1HistogramQuery do
  @moduledoc """
  The histogram request.

  ## Attributes

  *   `filters` (*type:* `GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1HistogramQueryPropertyNameFilter.t`, *default:* `nil`) - Optional. Filter the result of histogram query by the property names. It only works with histogram query count('FilterableProperties'). It is an optional. It will perform histogram on all the property names for all the document schemas. Setting this field will have a better performance.
  *   `histogramQuery` (*type:* `String.t`, *default:* `nil`) - An expression specifies a histogram request against matching documents for searches. See SearchDocumentsRequest.histogram_queries for details about syntax.
  *   `requirePreciseResultSize` (*type:* `boolean()`, *default:* `nil`) - Controls if the histogram query requires the return of a precise count. Enable this flag may adversely impact performance. Defaults to true.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :filters =>
            GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1HistogramQueryPropertyNameFilter.t()
            | nil,
          :histogramQuery => String.t() | nil,
          :requirePreciseResultSize => boolean() | nil
        }

  field(:filters,
    as:
      GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1HistogramQueryPropertyNameFilter
  )

  field(:histogramQuery)
  field(:requirePreciseResultSize)
end

defimpl Poison.Decoder,
  for: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1HistogramQuery do
  def decode(value, options) do
    GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1HistogramQuery.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1HistogramQuery do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
